using Senparc.Weixin.MP.AdvancedAPIs.TemplateMessage;
using Senparc.Weixin.MP.CommonAPIs;
using System;
namespace Senparc.Weixin.MP.AdvancedAPIs
{
	public static class TemplateApi
	{
		public static SendTemplateMessageResult SendTemplateMessage(string accessTokenOrAppId, string openId, string templateId, string topcolor, string url, object data, int timeOut = 10000)
		{
			return ApiHandlerWapper.TryCommonApi<SendTemplateMessageResult>(delegate(string accessToken)
			{
				TempleteModel data2 = new TempleteModel
				{
					touser = openId,
					template_id = templateId,
					topcolor = topcolor,
					url = url,
					data = data
				};
				return CommonJsonSend.Send<SendTemplateMessageResult>(accessToken, "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token={0}", data2, CommonJsonSendType.POST, timeOut, false);
			}, accessTokenOrAppId, true);
		}
	}
}
